import Vue from 'vue'
import Router from 'vue-router'
import config from '@/config/baseUrl'
Vue.use(Router)
import dashboard from '@/components/DashboardPage';
import welcome from '@/components/WelcomePage';
import goods from '@/components/Goods/GoodsPage';
import goods_add from '@/components/Goods/GoodsAddPage';
import category from '@/components/Category/CategoryPage';
import category_add from '@/components/Category/CategoryAddPage';
import brand from '@/components/Brand/BrandPage';
import brand_add from '@/components/Brand/BrandAddPage';
import order from '@/components/Order/OrderPage';
import order_detail from '@/components/Order/OrderDetailPage';
import topic from '@/components/Topic/TopicPage';
import topic_add from '@/components/Topic/TopicAddPage';
import user from '@/components/User/UserPage';
import user_add from '@/components/User/UserAddPage';
import login from '@/components/LoginPage';
import game from '@/components/Game/GamePage';
import game_add from '@/components/Game/GameAddPage';
import game_user from '@/components/Game/GameUserPage';

export default new Router({
	// mode: 'history',
	base:`${config.baseNameRouter}`,
    scrollBehavior: () => ({
        y: 0
    }),
    routes: [{
        path: '/',
        name: 'dashboard',
        redirect: '/dashboard'
    }, {
        path: '/dashboard',
        name: 'dashboard',
        component: dashboard,
        children: [{
            path: '/',
            name: 'welcome',
            component: welcome
        }, {
            path: 'goods',
            name: 'goods',
            component: goods
        }, {
            path: 'goods/add',
            name: 'goods_add',
            component: goods_add
        }, {
            path: 'category',
            name: 'category',
            component: category
        }, {
            path: 'category/add',
            name: 'category_add',
            component: category_add
        }, {
            path: 'brand',
            name: 'brand',
            component: brand
        }, {
            path: 'brand/add',
            name: 'brand_add',
            component: brand_add
        }, {
            path: 'order',
            name: 'order',
            component: order
        }, {
            path: 'order/detail',
            name: 'order_detail',
            component: order_detail
        }, {
            path: 'operate/topic',
            name: 'topic',
            component: topic
        }, {
            path: 'operate/topic/add',
            name: 'topic_add',
            component: topic_add
        }, {
            path: 'game',
            name: 'game',
            component: game
        }, {
            path: 'game/add',
            name: 'game_add',
            component: game_add
        },
		{
		    path: 'game/user',
		    name: 'game_user',
		    component: game_user
		},{
            path: 'user',
            name: 'user',
            component: user
        }, {
            path: 'user/add',
            name: 'user_add',
            component: user_add
        }, ]
    }, {
        path: '/login',
        name: 'login',
        component: login
    }, {
        path: '*',
        redirect: '/dashboard'
    }]
})